package com.zxy.ziems.common.mqtt.pojo;

import cn.hutool.core.date.LocalDateTimeUtil;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * mqtt消息的payload
 * @author 10348359
 * @create 2024-04-29 19:24
 */
@Data
public class MqttMessagePayload <T>{

    private LocalDateTime time;

    private T data;

    public MqttMessagePayload(T data, LocalDateTime time) {
        this.time = time;
        this.data = data;
    }

    public MqttMessagePayload(T data) {
        this.data = data;
        this.time = LocalDateTimeUtil.now();
    }
}
